package com.example.mall.client.fallback;

import com.example.mall.client.AuthFeignClient;
import com.example.mall.domain.Login;
import com.example.mall.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: xxxliu
 * @CreateTime: 2025-05-14
 * @Version: 1.0
 */
@Component
public class AuthFeignClientFactory implements FallbackFactory<AuthFeignClient> {
    @Override
    public AuthFeignClient create(Throwable throwable) {
        return new AuthFeignClient() {
            @Override
            public JSONResult insert(Login login) {
//                throwable.printStackTrace();
                return JSONResult.error("登录信息保存失败");
            }
        };
    }
}
